<template>
 <div>
    <el-table
      :data="arr"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      :tree-props="{ children: 'children' }"
    >
      <el-table-column prop="id" label="活动名称"  width="180">
      </el-table-column>
      <el-table-column label="状态"  width="180">
        <template slot-scope="scope">
          <el-button v-if="scope.row.status == 1" type="primary"
            >启用</el-button
          >
          <el-button v-else type="info">禁用</el-button>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="操作"  width="180">
        <template slot-scope="scope">
          <el-button type="primary" @click="willUpdate(scope.row.uid)">编辑</el-button>
          <el-button type="danger" @click="del(scope.row.uid)">删除</el-button>
        </template>
      </el-table-column>
   
    </el-table>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import { reqseckdelete } from '../../../http/api';
import { successAlert } from '../../../utils/alert';
export default {
  props: ['arr'],
  data() {
    return {};
  },
  computed: {
    ...mapGetters({}),
  },
  mounted() {},
  methods: {
    ...mapActions({}),
     // 点了编辑
    willUpdate(id) {
      this.$emit("willUpdate",id);
    },
    del(id){
      this.$confirm('你确定要删除吗?','提示',{
         confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(()=>{
        //删除的请求
        reqseckdelete({id:id}).then(res=>{
          if(res.data.code===200){
            //弹成功
            successAlert(res.data.msg)
            //刷列表
            this.$emit('init')
          }
        })
      })
    },
    
   
  },
};
</script>
<style scoped lang="less">
@import "../../../less/index.less";
</style>